package com.hc.model.code04.test5.after;

/**
 * @version v1.0
 * @ClassName: Context
 * @Description: 上下文对象
 * @Author: HC
 */
public class Context {

    // 声明对应状态对象的常量
    public final static OpenState OPEN_STATE = new OpenState();
    public final static RunningState RUNNING_STATE = new RunningState();
    public final static StoppingState STOP_STATE = new StoppingState();
    public final static CloseState CLOSE_STATE = new CloseState();

    private LiftState liftState;

    public LiftState getLiftState() {
        return liftState;
    }

    public void setLiftState(LiftState liftState) {
        this.liftState = liftState;
        this.liftState.setContext(this);
    }

    public void open() {
        this.liftState.open();
    }

    public void run() {
        this.liftState.run();
    }

    public void stop() {
        this.liftState.stop();
    }

    public void close() {
        this.liftState.close();
    }
}
